{include file="Public:header" /}
{include file="Public:nav" /}	

	<body>
		<div class="bar bar-nav">
			<h1 class="title">我关注的</h1>
			<i class="icon icon-left" onclick="window.history.go(-1);"></i>
		</div>

		<div class="content">
			<div class="buttons-tab screen" style="margin-top:10px;">
				<a href="#follow_1" class="tab-link active button">活动</a>
				<a href="#follow_2" class="tab-link button">专家</a>
<!--				<a class="tab-link button">其他单位</a>
				<a class="tab-link button">基地</a>
				<a class="tab-link button">第三方服务</a>-->
			</div>
			
			<div class="tabs">
				<div id="follow_1" class="tab in_hot_box activity_1 active">
				{if condition="$activity_show"}<div style="text-align:center;"><a style="font-size:12px;border-bottom:1px solid #ddd;line-height:20px;display:inline-block;margin-bottom: 10px;">我关注了{$collect_count}个活动</a></div>{/if}
				<div id="collect_activity">
				{foreach name="activity" item="act" key="k"}
					<div cl="123" class="card demo-card-header-pic user_order_card">
					  <div class="card-header" style="min-height: auto; padding: 0.15rem 0rem;margin-bottom: 10px;"><span><span class="iconfont icon-huiyuan1"></span> {$act['sponsor']}</span>
					  <a class="confirm-ok" collect_id="{$act['id']}" href="javascript:void(0);" style="margin-right: 1.05rem;">
					  	取消关注
					  </a>
					  </div>
						<a href="{:U('ActivityDetail/index',array('activity_id'=>$act['activity_id']))}">
						<div valign="bottom" class="card-header color-white no-border no-padding">
							<img class='card-cover' src="{$act['activity_img']}" style="border-radius: 0;" alt="">
						</div>
						<div class="card-content">
							<div class="card-content-inner">
								<p class="hot_list_title">{$act['activity_name']}</p>
								<p class="color-gray">{$act['start_time']|date="Y-m-d",###} 至 {$act['end_time']|date="Y-m-d",###}</p>
								<p class="color-gray"><a style="font-size:12px;color: #999;">{$act['area']}</a>
								<span><a class="button pull-right" style="display: inline-block;border-radius: inherit;font-size: 12px;font-weight: initial;">
								{if condition="$today lt $act['start_time']"} 
								未开始
								{elseif condition="($today egt $act['start_time']) and ($today elt $act['end_time'])"/}
								进行中
								{else/}
								已结束
								{/if}
								</a></span>
								 </p>
							</div>
						</div>
						</a>
					</div>
				{/foreach}	
				</div>
					{if condition="$activity_show"}
					<div class="infinite-scroll-preloader" id="activity_quan" style="display:none;">
						<div class="preloader"></div>
					 </div>
					<p onclick="ajax_sourch_submit();" class="activity_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
					{else/}
					<p id="load_more"> 暂无数据！</p>
					{/if}
				</div>
				
				<div id="follow_2" class="tab in_hot_box activity_1">
                                    {if condition="$make_show"}<div style="text-align:center;"><a style="font-size:12px;border-bottom:1px solid #ddd;line-height:20px;display:inline-block;margin-bottom: 10px;">我关注了{$make_collect_count}个预约</a></div>{/if}
                                    <div id="collect_make">
                                    {foreach name="make" item="make" key="mm"}
					<div cl="123" class="card demo-card-header-pic user_order_card">
					  <div class="card-header" style="min-height: auto; padding: 0.15rem 0rem;margin-bottom: 10px;">
                                              <span><span class="icon iconfont icon-favorite"></span>&nbsp;&nbsp;{$make['user_name']}&nbsp;&nbsp;
                                              [&nbsp;{switch name="make['type']"}
                                               {case value="1"}军事专家{/case}
                                               {case value="2"}国防专家{/case}
                                               {case value="3"}医学专家{/case}
                                            {/switch}&nbsp;]
                                              </span>
					  <a class="cancel" collect_id="{$make['id']}" href="javascript:void(0);" style="margin-right: 1.05rem;">
					  	取消关注
					  </a>
					  </div>
						<a href="{:U('Apply/expert_page',array('id'=>$make['apply_id']))}">
						<div valign="bottom" class="card-header color-white no-border no-padding">
							<img class='card-cover' src="{$make['headimgurl']}" style="border-radius: 0;" alt="">
						</div>
						<div class="card-content">
							<div class="card-content-inner">
								<p class="color-gray"><a style="font-size:12px;color: #999;">联系电话：{$make['phone']}</a></p>
                                                                <p class="color-gray">{$make['signature']}</p>
								<p class="color-gray">收藏于：{$make['create_time']|date="Y-m-d",###} {if condition="$make['status_show'] eq 1"} <span><a class="button pull-right" style="display: inline-block;border-radius: inherit;font-size: 12px;font-weight: initial;">进行中</a></span> {/if}</p>
							</div>
						</div>
						</a>
					</div>
                                    {/foreach}
                                    </div>
                                    {if condition="$make_show"}
					<div class="infinite-scroll-preloader" id="make_quan" style="display:none;">
						<div class="preloader"></div>
					 </div>
					<p onclick="ajax_sourchMake_submit();" class="make_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
					{else/}
					<p id="load_more"> 暂无数据！</p>
					{/if}
				</div>
			</div>
		</div>

{include file="Public:footer" /}

<script>
var  page = 1;
 /*** ajax 提交表单 查询订单列表结果*/  
 function ajax_sourch_submit()
 {	 	 	 
	 	$("#activity_quan").show();
        page += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/collect_activity/is_ajax/1/p/"+page,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#activity_quan").hide();
				if($.trim(data) == ''){
					$('.activity_more').hide();
				}else{
				    $("#collect_activity").append(data);
				}
			}
		}); 
 } 
 

 //取消收藏

  function ajax_sourchMake_submit()
 {	 	 	 
	 	$("#make_quan").show();
        page += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/collect_make/is_ajax/1/p/"+page,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#make_quan").hide();
				if($.trim(data) == ''){
					$('.make_more').hide();
				}else{
				    $("#collect_make").append(data);
				}
			}
		}); 
 }
 

 $(document).on('click','.confirm-ok', function () {
	 //alert($(this).parents('.user_order_card').attr('cl'));
	 //return false;
	 that = $(this);
	 var collect_id = $(this).attr('collect_id');
	 Zepto.confirm('你确定要取消关注吗?', function () {
		 cancel_collect(collect_id, that);
     });
 });
  
 $(document).on('click','.cancel', function () {
	 that = $(this);
	 var collect_id = $(this).attr('collect_id');
	 Zepto.confirm('你确定要取消关注吗?', function () {
		 cancel_make(collect_id, that);
     });
 });
 
 //异步发送
 function cancel_collect(collect_id, that){
	 $.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/cancel_collect/collect_id/"+collect_id,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data){
				if(data.status == 1){
					Zepto.alert(''+data.message+'');
					that.parents('.user_order_card').remove();
				}else{
					Zepto.alert(''+data.message+'');
				}
			}
		}); 
 }
  
 function cancel_make(collect_id, that){
	 $.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/cancel_make/collect_id/"+collect_id,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data){
				if(data.status == 1){
					Zepto.alert(''+data.message+'');
					that.parents('.user_order_card').remove();
				}else{
					Zepto.alert(''+data.message+'');
				}
			}
		}); 
 }
 </script>
